﻿<Window x:Class="DDOLayoutEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:DDOLayoutEditor"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        MinWidth="800" MinHeight="600"
        Title="Layout Editor" Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown_1" WindowStartupLocation="CenterScreen" Background="LightGray" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" MouseLeftButtonUp="Window_MouseLeftButtonUp_1" MouseMove="Window_MouseMove_1" MouseLeave="Window_MouseLeave_1" Initialized="Window_Initialized_1" LayoutUpdated="Window_LayoutUpdated_1">
    <Window.Resources>
        <DrawingBrush x:Key="GridBrush" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile" Opacity="0.3">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="Green" />
                    <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="Green" />
                </DrawingGroup>                
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <local:RelativePlacementConverter x:Key="RelativePlacementConverter" />
        <Storyboard x:Key="Animate">
            <ObjectAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                    <DiscreteObjectKeyFrame.Value>
                        <Visibility>Visible</Visibility>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimation BeginTime="0:0:0.0" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.2"/>
            <DoubleAnimation BeginTime="0:0:3.0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5"/>
            <ObjectAnimationUsingKeyFrames BeginTime="0:0:3.5" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0">
                    <DiscreteObjectKeyFrame.Value>
                        <Visibility>Hidden</Visibility>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>        
        <Canvas x:Name="mainCanvas" PreviewMouseLeftButtonDown="mainCanvas_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="mainCanvas_PreviewMouseLeftButtonUp" Loaded="mainCanvas_Loaded" SizeChanged="mainCanvas_SizeChanged">
            <Line x:Name="lineX" Stroke="Red" StrokeThickness="1" Visibility="Collapsed" Y1="0" />
            <Line x:Name="lineY" Stroke="Red" StrokeThickness="1" Visibility="Collapsed" X1="0" />
        </Canvas>
        <Canvas x:Name="contextCanvas">
            <Button x:Name="openButton" Content="Open" Canvas.Left="10" Canvas.Top="10" Width="75" Click="openButton_Click"/>
            <Button x:Name="saveButton" Content="Save" Canvas.Left="90" Canvas.Top="10" Width="75" Click="saveButton_Click" IsEnabled="False"/>
            <Button x:Name="settingsButton" Content="Settings" Canvas.Left="170" Canvas.Top="10" Width="76" Click="settingsButton_Click"/>
            <Button x:Name="categoriesButton" Content="Categories" Canvas.Left="298" Canvas.Top="10" Width="75" Click="categoriesButton_Click" IsEnabled="False"/>
            <Button x:Name="gridButton" Content="Grid" Canvas.Left="378" Canvas.Top="10" Width="75" Click="gridButton_Click"/>
            <Button x:Name="backgroundButton" Content="Background" Canvas.Left="458" Canvas.Top="10" Width="124" Click="backgroundButton_Click"/>
            <Label x:Name="saveLabel" Content="File Saved" Canvas.Left="0" FontSize="20" Foreground="WHite" Background="Gold" Padding="10,5,10,5" BorderBrush="Goldenrod"  BorderThickness="1">
                <Canvas.Top>
                    <MultiBinding Converter="{StaticResource RelativePlacementConverter}">
                        <Binding ElementName="contextCanvas" Path="ActualHeight" />
                        <Binding ElementName="saveLabel" Path="ActualHeight" />
                    </MultiBinding>
                </Canvas.Top>
            </Label>
        </Canvas>
        <local:SettingsEditor x:Name="windowSettings" WindowStartupLocation="Center" WindowState="Closed" DesignerWindowState="Closed" IsModal="True" />
        <local:LayoutCategories x:Name="windowCategories" WindowStartupLocation="Center" WindowState="Closed" DesignerWindowState="Closed" IsModal="False" Height="460" />
    </Grid>
</Window>
